package com.example.behaviour.responsibilityChain;

// 网关责任链
public abstract class GatewayHandler {

    protected GatewayHandler nextGatewayHandler;

    public void setNextGatewayHandler(GatewayHandler handler) {
        this.nextGatewayHandler = handler;
    }

    // 处理方法
    public abstract void service();

    // 下一个处理器
    protected void nextService() {
        if (nextGatewayHandler != null) {
            nextGatewayHandler.service();
        }
    }


}
